/*
 * GbtSubject.h
 *
 *  Created on: 2018年2月19日
 *      Author: chuanjiang.zh@qq.com
 */

#ifndef GBTSUBJECT_H_
#define GBTSUBJECT_H_

#include "GbtType.h"

#ifdef __cplusplus
extern "C" {
#endif
///////////////////////////////////////////////////////////////////

#define GBT_SUBJECT_SEQ_LENGTH      20

#define GBT_SUBJECT_MIN_LENGTH      (GBT_UNICODE_LENGTH *2 + 2 + 3)
#define GBT_SUBJECT_MAX_LENGTH      (GBT_UNICODE_LENGTH *2 + GBT_SUBJECT_SEQ_LENGTH*2 + 3)


typedef struct GBT_Subject
{
    int type;
    char sender[GBT_UNICODE_LENGTH+1];
    char sseq[GBT_SUBJECT_SEQ_LENGTH+1];
    char receiver[GBT_UNICODE_LENGTH+1];
    char rseq[GBT_SUBJECT_SEQ_LENGTH+1];
} GBT_Subject;

typedef enum GBT_SubjectType
{
    GBT_SUBJECT_LIVE    = 0,
    GBT_SUBJECT_RECORD = 1
} GBT_SubjectType;


DLLEXPORT size_t gbtSubjectToString(const GBT_Subject* subject, char* str, size_t size);

DLLEXPORT BOOL gbtSubjectParse(GBT_Subject* subject, const char* str, size_t size);

DLLEXPORT int gbtSubjectGetType(const char* str, size_t size);

DLLEXPORT int gbtSubjectMakeSeq();

DLLEXPORT size_t gbtSubjectMakeSseq(char* str, size_t size, int type);

DLLEXPORT size_t gbtSubjectMakeRseq(char* str, size_t size);

DLLEXPORT BOOL gbtSubjectMake(GBT_Subject* subject, int type, const char* sender, const char* receiver);

///////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif


#endif /* GBTSUBJECT_H_ */
